package stopthread;

/**
 * @description:
 * @author: jhy
 * @time: 2021/4/11 22:11
 */

//线程对象调用interrupt()方法仅仅是在当前线程中做了一个停止标志，并不是正真的停止线程
public class InterruptMethodDemo1 {

    public static void main(String[] args) throws InterruptedException {
        MyThread myThread = new MyThread();
        myThread.start();
        myThread.interrupt();
        System.out.println("=====main方法执行完毕======");

    }


}

class MyThread extends Thread{
    @Override
    public void run() {
        for(int i = 0;i < 50000;i++){
            System.out.println("i = " + (i+1));
        }
    }
}
